/*
 * Copyright 2010 Biz-e (info@biz-e.nl)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.biz_e.site.client;

import java.util.List;

import nl.biz_e.site.shared.models.NewsItem;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.googlecode.objectify.Key;

/**
 * Describes all the serverside services available for News items
 * 
 * @author Joost A. Bloemsma
 */
@RemoteServiceRelativePath("news")
public interface NewsService extends RemoteService {
	/**
	 * Persists a new or modified newsitem
	 * 
	 * @param item
	 * @param fulltext
	 * @return The sequence number of the item.
	 */
	public NewsItem saveNewsItem(NewsItem item, String fulltext);
	
	/**
	 * Get the last n number of NewsItems
	 * 
	 * @param count
	 * @return List of newsitems
	 */
	public List<NewsItem> getLastNewsItems(int count);
	
	/**
	 * Get a newsitem identified by sequencenumber
	 * 
	 * @param seqNr
	 * @return NewsItem
	 */
	public NewsItem getNewsItemByNr(long seqNr);
	
	/**
	 * Get all newsitems
	 * 
	 * @return A list of {@link Key}s for all newsitems
	 */
	public List<Key<NewsItem>> getAllKeys();
	
	/**
	 * @return all items
	 */
	public List<NewsItem> getAll();
	
	/**
	 * Gets the full text of the news item
	 * 
	 * @param item
	 * @return The full text
	 */
	public String getFullText(NewsItem item);
}
